home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 May: Tool Chest / Apple_Developer_CD_Series_May_1994_Tool_Chest.iso / Sample Code / AppsToGo / DTS.StyleChat / Start.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-24  |  2.7 KB  |  107 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** File:        Start.c
  5. ** Written by:    Eric Soldan
  6. **
  7. ** Copyright © 1989-1993 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11. /* You may incorporate this sample code into your applications without
  12. ** restriction, though the sample code has been provided "AS IS" and the
  13. ** responsibility for its operation is 100% yours.  However, what you are
  14. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  15. ** after having made changes. If you're going to re-distribute the source,
  16. ** we require that you make it clear in the source that the code was
  17. ** descended from Apple Sample Code, but that you've made changes. */
  18.  
  19.  
  20.  
  21. /*****************************************************************************/
  22.  
  23.  
  24.  
  25. #include "App.h"            /* Get the application includes/typedefs, etc.    */
  26. #include "App.protos.h"        /* Get the prototypes for application.            */
  27.  
  28. #ifndef __TEXTSERVICES__
  29. #include <TextServices.h>
  30. #endif
  31.  
  32. #ifndef __TOOLUTILS__
  33. #include <ToolUtils.h>
  34. #endif
  35.  
  36. #ifdef THINK_C
  37. #ifndef __HEADERS__            /* This include allows THINK to search all header files. */
  38. #include <Headers.h>
  39. #endif
  40. #endif
  41.  
  42.  
  43.  
  44. /*****************************************************************************/
  45.  
  46.  
  47.  
  48. #ifndef THINK_C
  49. extern void _DataInit();
  50. #endif
  51.  
  52. short    gQuickBalloons = (shiftKey | controlKey);
  53.  
  54.  
  55.  
  56. /*****************************************************************************/
  57. /*****************************************************************************/
  58.  
  59.  
  60.  
  61. #pragma segment Main
  62. void    main(void)
  63. {
  64.     NamesTableEntry    appNTE;
  65.     EntityName        appEntityName;
  66.     OSErr            atErr;
  67.  
  68. #ifndef THINK_C
  69.     UnloadSeg((Ptr)_DataInit);        /* Note that _DataInit can't be in Main! */
  70. #endif
  71.  
  72.     SetApplLimit(GetApplLimit() - 16384);
  73.         /* This decreases the application heap by 16k, which in turn
  74.         ** increases the stack by 16k. */
  75.  
  76.     MaxApplZone();                    /* Expand the heap so code segments load at the top. */
  77.  
  78.     Initialize(32, kMinHeap, kMinSpace, nil, nil);    /* Initialize the program. */
  79.     DoSetResCursor(watchCursor);                    /* Rest of startup may take a while. */
  80.     InitRequiredAppleEvents();
  81.     InitConnectAppleEvents();
  82.     InitCustomAppleEvents();
  83.     InitWFMTAppleEvents();
  84.     GetWindowFormats();                        /* Get the window definition resource information. */
  85.     OpenRuntimeOnlyAutoNewWindows();
  86.     DoOpenApplication();
  87.     DoAdjustMenus();
  88.     StartDocuments();                        /* Open (or print) designated documents for 6.0. */
  89.  
  90.     if(CTEUseTSMTE())
  91.         InitTSMAwareApplication();
  92.  
  93.     UnloadSeg((Ptr)Initialize);        /* Initialize can't be in Main! */
  94.  
  95.     atErr = AddPPCNBPAlias(&appNTE, "\pDTS.Chat", &appEntityName);
  96.     EventLoop();
  97.     if (!atErr) RemoveNBPAlias(&appEntityName);
  98.  
  99.     if(CTEUseTSMTE())
  100.         CloseTSMAwareApplication();
  101.  
  102.     ExitToShell();                    /* Quit the application. */
  103. }
  104.  
  105.  
  106.  
  107.